|
|
|
|
|
|
|
Learn the naming standards for controls |
|
|
|
|
|
|
|
|
Sample Project File Name: \Chapter04\ListsMenus.vbp |
|
|
|
|
|
|
|
|
A list box control provides a list of items you want to display to the user as choices he or she may choose from. For example, you might use a list box to display a complete list of employees or maybe a list of options to the user about the employees. You only use a list box control when you have some substantial real estate on your form. If youre limited on space and want to have multiple items displayed, a combo box will work better. Combo boxes are covered in the next section. |
|
|
|
|
|
|
|
|
A list box has a List property that contains a list of the items to display. These items may be sorted by setting the Sorted property to True. You can choose to have the user select just one item from the list or have the user select multiple items by setting the MultiSelect property to either Simple or Extended, respectively. You can also set the Style property to Checkbox. |
|
|
|
|
| Adding a List Box 1. Add a new label at the bottom of the form. You might need to make the form longer to accommodate this new label and the list box youll be adding. Set the Caption property of the label to Health Care Choices. 2. Add a list box to the right of this label. 3. Set the Name property to lstHealth. 4. Click the List property to see a drop-down list. 5. Add five or six health care companies to this list. After adding a choice to the List property, you need to press Ctrl+Enter to move to the next line. |
|
|
|